# Contributor: Johan Bergström <bugs@bergstroem.nu>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=cjose
pkgver=0.6.2.2
pkgrel=1
pkgdesc="A C library implementing the Javascript Object Signing and Encryption"
url="https://github.com/OpenIDC/cjose"
arch="all"
license="MIT"
makedepends="
	check-dev
	coreutils
	doxygen
	jansson-dev
	openssl-dev>3
	perl
	"
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/OpenIDC/cjose/archive/v$pkgver.tar.gz"

# secfixes:
#   0.6.2.2-r0:
#     - CVE-2023-37464

build() {
	CFLAGS="$CFLAGS -Wno-error" \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--enable-static=no \
		--with-openssl=/usr \
		--with-jansson=/usr \
		--disable-doxygen-ps \
		--disable-doxygen-pdf
	make
	# need to invoke doc generation, otherwise it doesn't get installed properly
	make doxygen
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	install -Dvm644 LICENSE \
		-t "$pkgdir"/usr/share/licenses/$pkgname/
}

sha512sums="
71a087709816f0aac060a7c5f037068e981366b1809f6ee32e39eaded02ad8be061b0e2fa5093515a8acec10c7f4aca232281004426221b4b7e5edbd203eb49c  cjose-0.6.2.2.tar.gz
"
